// Types
import { InvoiceType } from '@/types';

import { useTranslationContext } from '@/context/TranslationContext';
//
import Subheading from '../../reusable/Subheading';
import DynamicInvoiceTemplate from '../../templates/invoice-pdf/DynamicInvoiceTemplate';

type LivePreviewProps = {
    data: InvoiceType;
};

export default function LivePreview({ data }: LivePreviewProps) {
    const { _t } = useTranslationContext();

    return (
        <>
            <Subheading>{_t('actions.pdfView') ?? 'Live Preview'}:</Subheading>
            <div className="border dark:border-gray-600 rounded-xl my-1">
                <DynamicInvoiceTemplate {...data} />
            </div>
        </>
    );
}
